# -*- coding: utf8 -*-
from kivy import Logger
from kivy.properties import StringProperty

from kivy.uix.button import Button
from kivy.uix.boxlayout import BoxLayout


class EasyLangLearnButton(Button):
    button_id = StringProperty()

    def __init__(self, **kwargs):
        super(EasyLangLearnButton, self).__init__(**kwargs)

        Logger.info('Button: init')

    def on_press(self):
        super(EasyLangLearnButton, self).on_press()

        Logger.info('Button: id: ' + self.button_id)


class EasyLangLearnImageButton(BoxLayout, EasyLangLearnButton):
    icon = StringProperty()
    label = StringProperty()

    def __init__(self, icon, text, **kwargs):
        super(EasyLangLearnImageButton, self).__init__(**kwargs)

        self.label = text
        self.icon = icon


class EasyLangLearnButtonLang(EasyLangLearnImageButton):
    def __init__(self, button_id, lang_id, title):
        super(EasyLangLearnButtonLang, self).__init__('%s.png' % button_id, title)

        self.button_id = button_id
        self.lang_id = lang_id

    def on_press(self):
        super(EasyLangLearnButtonLang, self).on_press()

        self.parent.parent.next_page(self.lang_id)

